/* 3.1 О выборе заявок */

#include <stdio.h>
#include <stdlib.h>

struct act
{
	int num;
	int s; //start
	int f; //finish
};

int cmp(const void* v1, const void* v2);

int main()
{
	struct act a[100] = {0};
	int r[100] = {0};
	int n = 0, i = 0, k = 0, f = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d%d", &(a[i].s), &(a[i].f));
		a[i].num = i;
	}
	qsort(a, n, sizeof(struct act), cmp);
	
	r[0] = a[0].num;
	f = a[0].f;
	k = 1;
	for (i = 1; i < n; i++)
		if (a[i].s >= f)
		{ 
			r[k] = a[i].num;
			f = a[i].f;
			k++;
		}	

	for (i = 0; i < k; i++)
		printf("%d ", r[i]);
	printf("\n");	
	return 0;
}

int cmp(const void* v1, const void* v2)
{
	struct act *a1 = (struct act*) v1;
	struct act *a2 = (struct act*) v2;
	return (a1->f - a2->f);
}

